package com.myc.demo3.permission.serviceapi;

import com.alibaba.dubbo.config.annotation.Service;
import com.myc.demo3.permission.api.PermissionServiceApi;
import com.myc.demo3.permission.entity.Permission;
import com.myc.demo3.permission.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Description: 这是对外发布的接口，其他服务可以调用此接口，这里使用的@Service为dubbo的接口，而不是spring的
 * @Author: mayc
 * @Date: 2020/1/8 14:45
 */
@Service(version = "1.0")
public class PermissionServiceApiImpl implements PermissionServiceApi {
    private String perm = "add,delete,update,select";

    @Autowired
    private PermissionService permissionService;
    @Override
    public String getPermissionByRoleId(String roleId) {
        return roleId+"的权限为：[" + perm + "]";
    }

    @Override
    public String getPermissionNameById(Long id) {
        Permission p = permissionService.getById(id);
        return p.getName();
    }
}
